package com.skyolder.crutch.ast;

import com.skyolder.crutch.error.GrammarError;
import com.skyolder.crutch.error.RunError;
import com.skyolder.crutch.ev.Environment;
import com.skyolder.crutch.word.TokenQueue;
import com.skyolder.crutch.word.token.KeyWordToken;
import com.skyolder.crutch.word.token.SymbolToken;
import com.skyolder.crutch.word.token.Token;
import com.skyolder.crutch.word.types.KeyWordType;
import com.skyolder.crutch.word.types.SymbolType;

public class ElifTree implements Tree {
	Environment parentEnvironment = null;
	TokenQueue tokenQueue = null;
	public ElifTree(Environment environment, TokenQueue tokenQueue) {
		this.parentEnvironment = environment;
		this.tokenQueue = tokenQueue;
	}
	@Override
	public void build() throws GrammarError {
		// TODO Auto-generated method stub
		Token token=tokenQueue.nextToken();
		if(!(token instanceof KeyWordToken)){
			throw new GrammarError(token.toString());
		}
		KeyWordToken keyWordToken=(KeyWordToken)token;
		if(keyWordToken.getKeyWordType()!=KeyWordType.ELIF){
			throw new GrammarError(token.toString());
		}
		token=tokenQueue.nextToken();
		if(!(token instanceof SymbolToken)){
			throw new GrammarError(token.toString());
		}
		SymbolToken symbolToken=(SymbolToken)token;
		if(symbolToken.getSymbolType()!=SymbolType.LBRACKET){
			throw new GrammarError(token.toString());
		}
	}

	@Override
	public void excute() throws RunError {
		// TODO Auto-generated method stub
		
	}
	public boolean getProbe(){
		return false;
	}
}
